/*
 * couponBO.java
 *
 * Created on March 17, 2007, 2:14 PM
 *
 */

package edu.byu.isys413.mystuff;

/**
 *
 * @author Sam Griffiths
 */
public class couponBO {
    
    //Initialize variables for Coupon
    private String couid;
    private double amt;
    private String tlineid;
    private boolean dirty = false;   
    private boolean alreadyInDatabase = false;
    
    /** Creates a new instance of customerBO */
    public couponBO() {
    }
        
    //creates a new coupon bo with id initialized
    public couponBO(String couid) {
    this.couid = couid;
    }
    
    //returns couponid
    public String getCouponId() {
        return couid;
    }
    
    //returns the discount value
    public double getAmount() {
        return amt;
    }

    //sets discount value
    public void setAmount(double amt) {
        this.amt = amt;
        setDirty(true);
    }

    //returns associated Transaction Line
    public String getTransactionLineId() {
        return tlineid;
    }
    
    //Sets id of corresponding Transaction Line
    public void setTransactionLineId(String tlineid){
        this.tlineid = tlineid;
        setDirty(true);
    }

    //outputs all variables in a single string
    public String toString(){
        return "Coupon id: "+ this.getCouponId()+" \n"+
               "Amount   : "+ this.getAmount()+" \n"+
               "TLineid  : "+ this.getTransactionLineId() +" \n";
    }

    //returns wether or not this object as been updated since read or saved
    public boolean isDirty() {
        return dirty;
    }

    //sets dirty or clean
    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }

    //returns if object is already saved to database
    public boolean isAlreadyInDatabase() {
        return alreadyInDatabase;
    }

    //sets object as being or not being in database
    public void setAlreadyInDatabase(boolean alreadyInDatabase) {
        this.alreadyInDatabase = alreadyInDatabase;
    }
}